package org.example.backend.controller;

import org.example.backend.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/file")
@CrossOrigin(origins = "*")
public class FileController {

    @Autowired
    private FileService fileService;

    // 通过政策id下载政策正文为txt文件
    @GetMapping("/downloadPolicyText/{id}")
    public ResponseEntity<?> downloadPolicyTextById(@PathVariable String id) {
        return fileService.downloadPolicyTextById(id);
    }
}
